package com.sqllite.springbootsqlitejdbc.repository;


import com.sqllite.springbootsqlitejdbc.bean.CreditRepay60;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CreditRepay60Repository {
    private final JdbcTemplate jdbcTemplate;

    public CreditRepay60Repository(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public List<CreditRepay60> findAll() {
        String sql = "SELECT * FROM tmp_credit_pboc_acc_repay_60_monthly";
        return jdbcTemplate.query(sql, (rs, rowNum) -> {
            CreditRepay60 creditRepay60 = new CreditRepay60();
            creditRepay60.setId(rs.getString("id"));
            creditRepay60.setDataDt(rs.getString("data_dt"));
            creditRepay60.setRequestId(rs.getString("request_id"));
            creditRepay60.setOrderId(rs.getString("order_id"));
            creditRepay60.setUserCertNo(rs.getString("user_cert_no"));
            creditRepay60.setPa01bi01(rs.getString("pa01bi01"));
            creditRepay60.setPa01ai01(rs.getString("pa01ai01"));
            creditRepay60.setPa01ar01(rs.getString("pa01ar01"));
            creditRepay60.setPd01ai01(rs.getString("pd01ai01"));
            creditRepay60.setPd01er03(rs.getString("pd01er03"));
            creditRepay60.setPd01ed01(rs.getString("pd01ed01"));
            creditRepay60.setPd01ej01(rs.getString("pd01ej01"));
            creditRepay60.setCreateTime(rs.getString("create_time"));
            creditRepay60.setUpdateTime(rs.getString("update_time"));
            creditRepay60.setAccRepayStatus(rs.getString("acc_repay_status"));
            creditRepay60.setAccRepayStatusSpec(rs.getString("acc_repay_status_spec"));
            creditRepay60.setAccRepayMoi(rs.getString("acc_repay_moi"));
            return creditRepay60;
        });
    }
}
